﻿using UnityEngine;
using System.Collections;

public class TouchScript : MonoBehaviour {
	TouchControls[] allTouchableObjects;
	// Use this for initialization
	void Start () {

	}
	void TouchEvents()
	{
		allTouchableObjects = FindObjectsOfType<TouchControls> ();
		foreach (Touch touch in Input.touches) {
				
				for (int i = 0; i < allTouchableObjects.Length; i++) {
					allTouchableObjects[i].Touched(Camera.main.ScreenToWorldPoint(touch.position),touch.phase,touch.fingerId);
				}
				}
	}
	// Update is called once per frame
	void Update () {
		TouchEvents ();
	}
}
